﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
namespace QiCheXiaoShouYongHu1
{
    public class DBHelper
    {
        static string fcdd = "Data Source=.;Initial Catalog=ZYXM;Integrated Security=True";

        public static int Write(string sql)
        {
            SqlConnection cf = new SqlConnection(fcdd);
            cf.Open();
            SqlCommand ml = new SqlCommand(sql, cf);
            int rs = ml.ExecuteNonQuery();
            cf.Close();
            return rs;
        }
        public static DataTable Read(string sql)
        {
            SqlConnection cf = new SqlConnection(fcdd);
            SqlDataAdapter cmd = new SqlDataAdapter(sql, cf);
            DataTable table = new DataTable();
            cmd.Fill(table);
            return table;
        }
    }
}

